import axios from 'axios';
import Qs from 'qs';
import config from '../config/config';

let util = {
	title: (title) => {
	    title = title ? title : 'innjia';
	    window.document.title = title;
	}
};

const ajaxUrl = config[config.env].host;

util.ajax = axios.create({
    baseURL: ajaxUrl,
    transformRequest: (data) => {
        return Qs.stringify(data)
    },
    headers: {'Content-Type':'application/x-www-form-urlencoded; charset=utf-8'},
    timeout: 5000
});

export default util;